package edu.washington.cs.workflow.recommender;

import java.util.Collections;
import java.util.List;

import edu.washington.cs.workflow.recommender.MethodSummarizer.MethodStatistic;
import junit.framework.TestCase;

public class TestMethodSummarizer extends TestCase {
	
	public void testSummarizeInGanttSavePrevious() {
		String oldTrace = "./tests/demo-traces/gantt_project_save_previous_state_old_version.txt";
		String[] newTraces = new String[]{"./tests/files/gantt_project_save_previous_state-hack-error-in-save-new_version.txt"};
		MethodSummarizer summarizer = new MethodSummarizer(oldTrace, newTraces);
//		List<MethodStatistic> stats = summarizer.summarizeMethodStatisticsInReverse();
//		List<MethodStatistic> stats = summarizer.summarizeMethodStatistics();
//		Collections.<MethodStatistic>sort(stats);
		
		List<MethodStatistic> stats = summarizer.getRankedMethodStatistics();
		
		int i = 0;
		for(MethodStatistic s : stats) {
			if(s.numOfActions > 0 && s.numOfHandlers > 0
//					&& s.numOfActions == 1
//					&& s.numOfHandlers == 1
//					&& s.toString().indexOf("Edit table input name") != -1
					) {
				System.out.println(s);
				if(i ++ > 10) {
					break;
				}
			}
		}
	}

}
